3d338c
@@ -5,7 +5,6 @@
import javax.el.ExpressionFactory;
 import org.springframework.beans.BeanInstantiationException;
 import org.springframework.beans.BeanUtils;
 import org.springframework.util.ClassUtils;
-import org.springframework.util.ReflectionUtils;
 
 /**
  * A helper for creating a new expression factory instance using the default expression factory class configured for the
@@ -14,27 +13,15 @@
import org.springframework.util.ReflectionUtils;
  * @author Keith Donald
  */
 public class DefaultExpressionFactoryUtils {
-	private static final String EXPRESSION_FACTORY_PROPERTY = "javax.el.ExpressionFactory";
 
-	static {
-		if (!System.getProperties().containsKey(EXPRESSION_FACTORY_PROPERTY)) {
-			// TODO - change default to Spring EL when it becomes available
-			setDefaultExpressionFactoryClassName("org.jboss.el.ExpressionFactoryImpl");
-		}
-	}
+	// TODO - change default to Spring EL when it becomes available
+	private static final String DEFAULT_EXPRESSION_FACTORY = "org.jboss.el.ExpressionFactoryImpl";
 
 	/**
 	 * Returns the type of ExpressionFactory configured for this VM.
 	 */
 	public static String getDefaultExpressionFactoryClassName() {
-		return System.getProperty(EXPRESSION_FACTORY_PROPERTY);
-	}
-
-	/**
-	 * Sets the type of ExpressionFactory configured for this VM.
-	 */
-	public static void setDefaultExpressionFactoryClassName(String expressionFactoryClassName) {
-		System.setProperty(EXPRESSION_FACTORY_PROPERTY, expressionFactoryClassName);
+		return DEFAULT_EXPRESSION_FACTORY;
 	}
 
 	/**
@@ -43,32 +30,26 @@
public class DefaultExpressionFactoryUtils {
 	 * @throws RuntimeException if the ExpressionFactory cannot be instantiated
 	 */
 	public static ExpressionFactory createExpressionFactory() throws IllegalStateException, RuntimeException {
-		if (ReflectionUtils.findMethod(ExpressionFactory.class, "newInstance") != null) {
-			return ExpressionFactory.newInstance();
-		} else {
-			// Fallback in the case of using an older version of the EL API
-			try {
-				Class expressionFactoryClass = ClassUtils.forName(getDefaultExpressionFactoryClassName());
-				return (ExpressionFactory) BeanUtils.instantiateClass(expressionFactoryClass);
-			} catch (ClassNotFoundException e) {
-				throw new IllegalStateException(
-						"The default ExpressionFactory class '"
-								+ getDefaultExpressionFactoryClassName()
-								+ "' could not be found in the classpath.  "
-								+ "Please add this to your classpath or set the default ExpressionFactory class name to something that is in the classpath.",
-						e);
-			} catch (NoClassDefFoundError e) {
-				throw new IllegalStateException(
-						"The default ExpressionFactory class '"
-								+ getDefaultExpressionFactoryClassName()
-								+ "' could not be found in the classpath.  "
-								+ "Please add this to your classpath or set the default ExpressionFactory class name to something that is in the classpath.",
-						e);
-			} catch (BeanInstantiationException e) {
-				throw new RuntimeException("An instance of the default ExpressionFactory '"
-						+ getDefaultExpressionFactoryClassName()
-						+ "' could not be instantiated.  Check your EL implementation configuration.", e);
-			}
+		// Fallback in the case of using an older version of the EL API
+		try {
+			Class expressionFactoryClass = ClassUtils.forName(getDefaultExpressionFactoryClassName());
+			return (ExpressionFactory) BeanUtils.instantiateClass(expressionFactoryClass);
+		} catch (ClassNotFoundException e) {
+			throw new IllegalStateException(
+					"The default ExpressionFactory class '"
+							+ getDefaultExpressionFactoryClassName()
+							+ "' could not be found in the classpath.  "
+							+ "Please add this to your classpath or set the default ExpressionFactory class name to something that is in the classpath.");
+		} catch (NoClassDefFoundError e) {
+			throw new IllegalStateException(
+					"The default ExpressionFactory class '"
+							+ getDefaultExpressionFactoryClassName()
+							+ "' could not be found in the classpath.  "
+							+ "Please add this to your classpath or set the default ExpressionFactory class name to something that is in the classpath.");
+		} catch (BeanInstantiationException e) {
+			throw new RuntimeException("An instance of the default ExpressionFactory '"
+					+ getDefaultExpressionFactoryClassName()
+					+ "' could not be instantiated.  Check your EL implementation configuration.", e);
 		}
 	}
 }
\ No newline at end of file
